package portal.servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import portal.excepcion.DAOExcepcion;

/**
 * Servlet implementation class AprobarCotizacionServlet
 */
@WebServlet("/AprobarCotizacionServlet")
public class AprobarCotizacionServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AprobarCotizacionServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		//Abrimos los datos guardados en sesion
		HttpSession session = request.getSession(true);
				
		String idPersona					= session.getAttribute("numeroDocumento").toString();
		String idCotizacion 				= request.getParameter("idCotizacion");
		
		
		Boolean respuestaSentenciaSQL = Boolean.TRUE;
		
			if (respuestaSentenciaSQL){
				//SI LA ACCION PROCEDE LISTA LAS DEMAS SOLICITUDES PENDIENTES
				String errmsg = "La cotizacion se aprobo correctamente. ";
				request.setAttribute("MENSAJE", errmsg);
				
				RequestDispatcher rd = request.getRequestDispatcher("ListarCotizacionesClienteServlet");
				rd.forward(request, response);
			}else{
				//ERROR
				String errmsg = "Error de credenciales. ";
				request.setAttribute("MENSAJE", errmsg);
				
				RequestDispatcher rd = request.getRequestDispatcher("ListarCotizacionesClienteServlet");
				rd.forward(request, response);
			}
			
		
		
		
		
				
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
